#include <windows.h>
#include <stdio.h>

#define N 20

void ClearScreen()
{
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coordScreen = {0, 0};
    DWORD cCharsWritten;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    DWORD dwConSize;

    // 获取控制台缓冲区大小
    GetConsoleScreenBufferInfo(hConsole, &csbi);
    dwConSize = csbi.dwSize.X * csbi.dwSize.Y;

    // 用空格填充整个屏幕
    FillConsoleOutputCharacter(hConsole, ' ', dwConSize, coordScreen, &cCharsWritten);

    // 重置光标位置到左上角
    SetConsoleCursorPosition(hConsole, coordScreen);
}

void ExplainPrint()
{
	//上边界
	for(int i = 0; i < 2*N+2; i++)
	    printf("-");
	printf("\n");
	//打印地图
    for(int i = 0; i < N; i++)
	{
		//左边界
		printf("|");
        if(i == 5)
        {
            printf("              游戏前详阅                |\n");
            continue;
        }
		if(i == 7)
		{
			printf("     请先调整游戏窗口至适宜的大小       |\n");
			continue;
		}
		if(i == 9)
		{
			printf("        游戏内勿随意调整窗口大小        |\n");
			continue;
		}
		if(i == 11)
		{
			printf("    按下选项前对应的数字以进入该选项    |\n");
			continue;
		}
		if(i == 13)
		{
			printf("          按回车键以开始游戏            |\n");
			continue;
		}
		for(int j = 0; j < N; j++)
		{
			printf("  ");
		}
		//右边界
		printf("|");
		printf("\n");
	}
	//下边界
	for(int i = 0; i < 2*N+2; i++)
	    printf("-");
	printf("\n");
}

int main()
{
    ExplainPrint();
    getchar();
    ClearScreen();
    printf("程序结束\n");
    return 0;
}
